<?php
namespace Imooc;

interface IDatabase
{
    function connect($host, $user, $passwd, $dbname);
    function query($sql);
    function close();
}

class Database
{
    protected static $db;
    //屏蔽构造函数，在其他地方不允许 实例化
    private function __construct()
    {

    }
    //获取实例
    static function getInstance()
    {
        if (self::$db){
            return self::$db;
        }else{
            self::$db = new self();
            return self::$db;
        }
    }

    function where($where)
    {
        return $this;
    }

    function order($order)
    {
        return $this;
    }

    function limit($limit)
    {
        return $this;
    }


    function test()
    {
        return __CLASS__.'test()';
    }
}